package com.nf.dbutils.handlers.properties;

import com.nf.dbutils.PropertyHandler;

import java.time.LocalDate;
import java.sql.Date;

public class LocalDatePropertyHandler implements PropertyHandler {
    @Override
    public boolean support(Class<?> clz, Object value) {
        return value instanceof Date && LocalDate.class.isAssignableFrom(clz);
    }

    @Override
    public Object apply(Class<?> clz, Object value) {
        return ((Date)value).toLocalDate();
    }
}
